home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 2,801 to 2,900 / aol-file-protocol-4400-2801-to-2900.zip / AOLDLs / C++ Files Library / HyperCuber Source / HyperCuber 2.0 Source.sit / HyperCuber 2.0 Source / CPPoint.cp < prev    next >
Text File  |  1994-04-27  |  3KB  |  99 lines

  1. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. //| This file contains the implementation of the CPPoint class.  A CPPoint
  3. //| is a graphics primitive.  It implements a colored point.
  4. //|________________________________________________________________________________
  5.  
  6.  
  7. #include "CPPoint.h"
  8.  
  9. #include <CList.h>
  10.  
  11.  
  12. //============================ Prototypes ============================\\
  13.  
  14.  
  15.  
  16. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  17. //| CPPoint::IPPoint
  18. //|
  19. //| Purpose: Initialize a point.
  20. //|
  21. //| Parameters: colors:   the color list
  22. //|_________________________________________________________
  23.  
  24. void CPPoint::IPPoint(CList *colors)
  25. {
  26.  
  27.     CPrimitive::IPrimitive(colors);            //  Initialize superclass
  28.  
  29. }    //==== CPPoint::IPPoint() ====\\
  30.  
  31.  
  32.  
  33. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  34. //| CPPoint::Dispose
  35. //|
  36. //| Purpose: Dispose of the point.
  37. //|
  38. //| Parameters: none
  39. //|_________________________________________________________
  40.  
  41. void CPPoint::Dispose(void)
  42. {
  43.  
  44.     CPrimitive::Dispose();
  45.  
  46. }    //==== CPPoint::Dispose() ====\\
  47.  
  48.  
  49.  
  50. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  51. //| Operator >> to extract CPPoint from stream
  52. //|
  53. //| Purpose: Read this point from the input stream
  54. //|
  55. //| Parameters: none
  56. //|_________________________________________________________
  57.  
  58. istream& operator>> (istream& s, CPPoint& p)
  59. {
  60.  
  61.     s >> p.color_index;                                            //  Get index of this point's color
  62.  
  63.     s >> p.vertex_index;                                        //  Get index of the vertex
  64.  
  65.     return s;
  66.     
  67. }    //==== Operator >> to extract CPPoint from stream ====\\
  68.  
  69.  
  70.  
  71. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  72. //| CPPoint::Draw
  73. //|
  74. //| Purpose: Draw this point.
  75. //|
  76. //| Parameters: override_color:  the color to use to draw the primitive
  77. //|                              If this is NULL, use the primitive's default
  78. //|             screen_vertices: the screen coordinates of the vertices
  79. //|             clip_rect:       the clipping rectangle
  80. //|             fAntialias:      TRUE if we should antialias
  81. //|__________________________________________________________________________
  82.  
  83. void CPPoint::Draw(RGBColor *override_color, Point **screen_vertices,
  84.                     Rect *clip_rect, Boolean fAntialias)
  85. {
  86.  
  87.     Point screen_point = *(*screen_vertices + vertex_index);    //  Get the 2D point
  88.     
  89.     RGBColor *color;
  90.     if (override_color)
  91.         color = override_color;                                    //  Use specified color, if any
  92.     else
  93.         color = *((RGBColor **) colors->NthItem(color_index));    //  Use default outline color
  94.  
  95.     SetCPixel(screen_point.h, screen_point.v, color);            //  Set the point to the proper color
  96.         
  97. }    //==== CPPoint::Draw() ====\\
  98.  
  99.